﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Windows.Controls;

namespace Cloak.Mvvm.Navigation
{
	/// <summary>
	/// Describes how page types map to view models
	/// </summary>
	[ContractClass(typeof(IPageModelMapContract))]
	public interface IPageModelMap
	{
		/// <summary>
		/// Gets a reference to the view model associated with the specified page type
		/// </summary>
		/// <param name="pageType">The type of page to map to a view model</param>
		/// <returns>A reference to the view model mapped to the page type, or null if the page type is not associated with a view model</returns>
		PageModelReference GetPageModelReference(Type pageType);
	}

	[ContractClassFor(typeof(IPageModelMap))]
	internal abstract class IPageModelMapContract : IPageModelMap
	{
		PageModelReference IPageModelMap.GetPageModelReference(Type pageType)
		{
			Contract.Requires(pageType != null);

			return null;
		}
	}
}